/*
 * Copyright © 2011-2015 Kinghood Group All Rights Reserved.
 * 未经本公司正式书面同意，其他任何个人、团体不得使用、复制、修改或发布本软件.
 * 版权所有深圳金雅福控股集团有限公司 www.jinyafu.com.
 */
package com.zhang.wanx.common;

import com.obs.services.ObsClient;
import com.obs.services.ObsConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Obs工具类
 *
 * @author Mike
 * @date 2020年7月22日下午3:37:30
 */
@Configuration
public class ObsConfig {

    public static final String bucketName = "obs-dev-test-public";

    /**
     * obs:
     * bucketName: obs-dev-test-public
     * accessKey: II3EI8YJCP9PWUBDLFSG
     * secrtKey: qqxHkkf9LIdOBOdGvavKBTDjFVM2bR08eWifE7bN
     * conf:
     * endPoint: obs.cn-east-2.myhuaweicloud.com
     * maxConnections: 1000
     * socketTimeout: 60000
     * maxErrorRetry: 3
     * connectionTimeout: 60000
     * socketReadBufferSize: 2048
     */
    @Bean(name = "obsClient")
    public ObsClient ObsClientSource() {

        String accessKey = "II3EI8YJCP9PWUBDLFSG";
        String secretKey = "qqxHkkf9LIdOBOdGvavKBTDjFVM2bR08eWifE7bN";
        ObsConfiguration obsConfiguration = new ObsConfiguration();
        obsConfiguration.setEndPoint("obs.cn-east-2.myhuaweicloud.com");
        obsConfiguration.setMaxConnections(1000);
        obsConfiguration.setSocketTimeout(6000);
        obsConfiguration.setMaxErrorRetry(3);
        obsConfiguration.setConnectionTimeout(6000);
        obsConfiguration.setSocketReadBufferSize(2048);
        return new ObsClient(accessKey, secretKey, obsConfiguration);
    }

}
